<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 300px;
        }
    </style>

</head>

<body>
    <img src="img/周星驰01.jpg" alt="">
    <div>上午好</div>
    <script>
        /* 
            分析需求:
               1.根据不同的时间,显示不同图片和div的内容
        */

        let hour = prompt('现在几点了?');
        let img = document.querySelector('img')
        let div = document.querySelector('div')
        if (hour < 12) {
            img.src = "img/周星驰01.jpg";
            div.innerHTML = '上午好';
        } else if (hour < 14) {
            img.src = "img/黄家驹.jpg";
            div.innerHTML = '中午好';
        } else {
            img.src = "img/恶搞.png";
            div.innerHTML = '晚上好';
        }
    </script>
</body>

</html>